package gormx

import (
	gormcConfig "github.com/SpectatorNan/gorm-zero/gormc/config"
	"github.com/SpectatorNan/gorm-zero/gormc/config/mysql"
	"gorm.io/gorm"
)

func MustNewMysql(c mysql.Mysql) (db *gorm.DB) {
	newLogger := gormcConfig.NewDefaultZeroLogger(&c)
	db, err := mysql.ConnectWithConfig(c, &gorm.Config{
		Logger: newLogger,
	})
	if err != nil {
		panic(err)
	}
	return db
}
